package com.ccit.dao;

import com.ccit.domain.AttendanceType;
import com.ccit.domain.Time;
import com.ccit.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserDao {

    /**
     * 添加用户
     */

    @Insert("insert into tb_user (username, password, employeeId) values (#{username}, #{password}, #{employeeId})")
    public int add(User user);

    @Select("select * from tb_user where username = #{username} and password = #{password}")
    User select(@Param("username") String username,@Param("password") String password);

    //查询所有员工信息
    @Select("select * from tb_user ")
    public List<User> selectAll();

    @Select("select * from time ")
    public List<Time> getTime();

    //根据用户名查询对象
    @Select("SELECT EXISTS(SELECT 1 FROM tb_user WHERE username = #{username})")
    Boolean selectByUsername(@Param("username") String username);


}
